import request from '@/utils/request'

export function getPage (data) {
  return request.get('/api/warehouse/page', { params: data })
}

// 删除仓库
export function del (id) {
  return request.delete(`/api/warehouse?ids[]=${id}`)
}

// 修改仓库
export function put (data) {
  return request.put('/api/warehouse', data)
}

// 获取下一个编码
export function getNext (name) {
  return request.get(`/api/codeFactory/next/${name}`)
}

// 查询仓库
export function getWarehouse (id) {
  return request.get(`/api/warehouse/${id}`)
}

// 新增仓库
export const addWarehouse = data => request.post('/api/warehouse', data)

// 分页查询库区详细信息
export function getAreaPage (data) {
  return request.get('/api/area/pageDetail', { params: data })
}

// 删除库区
export function delArea (id) {
  return request.delete(`/api/area?ids[]=${id}`)
}

// 修改库区
export function putArea (data) {
  return request.put('/api/area', data)
}

// 查询库区
export function getArea (id) {
  return request.get(`/api/area/${id}`)
}

// 新增库区
export const addArea = data => request.post('/api/area', data)

// 查询全部仓库
export function getWarehouseList (data) {
  return request.get('/api/warehouse/list', { params: data })
}

// 查询全部库区
export function getAreaList (data) {
  return request.get('/api/area/list', { params: data })
}

// 分页查询库位详细信息
export function getLocationPage (data) {
  return request.get('/api/location/pageDetail', { params: data })
}

// 修改库位
export function putlocation (data) {
  return request.put('/api/location', data)
}

// 删除库区
export function delLocation (id) {
  return request.delete(`/api/location?ids[]=${id}`)
}

// 查询全部库位
export function getLocationListDetail (data) {
  return request.get('/api/location/listDetail', { params: data })
}

// 查询库位
export function getLocation (id) {
  return request.get(`/api/location/${id}`)
}

// 新增库位
export const addLocation = data => request.post('/api/location', data)

// 修改库位
export function putLocation (data) {
  return request.put('/api/location', data)
}

// 导入
export const importExcelArea = data => request.post('/api/area/importExcel', data)

// 查询库区总览
export function getAreaOverview (id) {
  return request.get(`/api/area/overview/${id}`)
}
